<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script src="js/vue.min.js"></script>
    <title>vue计数器</title>
</head>
<body>
<div id="app">
    <h2>当前计数器：{{count}}</h2>
    <button v-on:click="add()">+</button>
    <button @click="sub()">-</button>
</div>
<script>
    const app = new Vue({
        el:"#app",
        data:{
            count:0
        },
        methods:{
            add:function () {
                this.count++;
            },
            sub:function () {
                this.count--;
            }
        }
    });


</script>
</body>
</html>